# -*- codeing = utf-8 -*-
# @Time : 2021/3/15 0015 20:45
# @Author : Alan Franklin
# @File : UI_initial.py
# @Software: PyCharm
from tkinter import *
from tkinter.messagebox import *
from UI_globalstack import *
from UI_login import *
from UI_register import *

global imagefile


class InitialInterface(object):
    def __init__(self, master=None):
        self.root = master
        self.root.geometry('720x480')
        self.CreatePage()

    def CreatePage(self):
        self.page = Frame(self.root)
        self.page.pack()
        global imagefile
        imagefile = PhotoImage(file='xml/cover.png')
        canvas = Canvas(self.page, bg='white', height=248, width=332)
        canvas.create_image(0, 0, anchor='nw', image=imagefile)
        canvas.pack()
        Label(self.page, text='欢迎使用百器纲目', font=('Arial', 12), width=60, height=1).pack()
        Button(self.page, text='登录', font=('Arial', 12), width=30, height=1, command=self.GotoLogin).pack()
        Button(self.page, text='注册', font=('Arial', 12), width=30, height=1, command=self.GotoRegister).pack()

    def GotoLogin(self):
        self.page.destroy()
        gs.mystack.Push(self)
        LoginInterface(self.root)

    def GotoRegister(self):
        self.page.destroy()
        gs.mystack.Push(self)
        RegisterInterface(self.root)
